﻿using System.Collections.Generic;
using System.Linq;
using eCommerce.Core.Data;
using eCommerce.Core.Domain.Products;

namespace eCommerce.Services.Products
{
    public class ItemService:IItemService
    {

        private IRepository<ItemGroup> _itemGroupRep;

        public ItemService(IRepository<ItemGroup> itemGroupRep)
        {
            _itemGroupRep = itemGroupRep;
        }

        public ItemGroup GetItemGroupByNo(string itemGroupNo)
        {
            var itemGroup = _itemGroupRep.Table.SingleOrDefault(c => c.ItemGroupNo == itemGroupNo);
            return itemGroup;
        }
    }

    public interface IItemService
    {
        ItemGroup GetItemGroupByNo(string itemGroupNo);
    }
}